<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

//负责处理数据和业务逻辑，提供 创建、读取、更新、删除等操作。
class Expert extends Model
{
    use HasFactory;
    use SoftDeletes;
    public function middle(){
        return $this->belongsToMany(Video::class,'middles','expert_id','video_id')
            ->withTimestamps();//withTimestamps用于自动维护中间表字段
    }
    protected $fillable=[
        'name',
        'title',
        'image',
        'job',
        'department',
        'hospital',
        'introduce',
        'education',
    ];
}
